local hx__longluo = fk.CreateSkill{
  name = "hx__longluo",

  tags = {Skill.Compulsory},
}

hx__longluo:addAcquireEffect(function (self, player, is_start)
  local room = player.room
  for _, v in ipairs(room:getOtherPlayers(player)) do
    room:damage{
      to = v,
      damage = 1,
      from = player,
      skillName = hx__longluo.name,
    }
  end
end)

hx__longluo:addEffect(fk.SkillEffect,{
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(hx__longluo.name) and (table.contains(data.skill:getSkeleton().tags,Skill.Wake) or table.contains(data.skill:getSkeleton().tags,Skill.Limited))
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    for _, v in ipairs(room:getOtherPlayers(player)) do
      room:damage{
      to = v,
      damage = 3,
      from = player,
      skillName = hx__longluo.name,
    }
    end
  end,
})

hx__longluo:addEffect(fk.EnterDying,{
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(hx__longluo.name) and target and target ~= player and data.damage and data.damage.from == player
  end,
  on_cost = function (self, event, target, player, data)
    local num = target.maxHp - 1
    if num > 0 then
      event:setCostData(self,num)
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local num = event:getCostData(self)
    room:changeMaxHp(target,-num)
    room:changeMaxHp(player,num)
    room:recover{
      who = player,
      num = num,
      recoverBy = player,
      skillName = hx__longluo.name,
    }
  end,
})

return hx__longluo